package xhwl.insurance.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;

import xhwl.insurance.R;
import xhwl.insurance.http.bean.resp.ForumSearchResp;
import xhwl.insurance.ui.ForumSearchActivity;

/**
 * Created by Administrator on 2017/10/12.
 */

public class SearchForumAdapter extends BaseAdapter
    {

        private Context context;
        ArrayList<ForumSearchResp> mList;


    public SearchForumAdapter(Context context, ArrayList<ForumSearchResp> mList) {
        super();
        this.context = context;
        this.mList = mList;
    }


        @Override
        public int getCount() {
        return mList.size();
    }

        @Override
        public Object getItem(int position) {
        return mList.get(position);
    }


        @Override
        public long getItemId(int position) {
        return position;
    }

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = LinearLayout.inflate(context, R.layout.item_search, null);
            holder.aloneview_txt = (TextView) convertView.findViewById(R.id.aloneview_txt);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        holder.aloneview_txt.setText(mList.get(position).getPOST_TITLE());


        return convertView;
    }

        class ViewHolder{
            TextView aloneview_txt;
        }
    }
